Export to Word Issue

Please forgive me in advance if my explanation lacks the proper terminology.  I have been asked to create a report using data from DOORS.  I am able to create a view that searches the necessary module for links that contain a specific attribute (a report).  The issue is some rows have multiple reports.  When the layout dxl is displayed in word the reports are displayed properly.  They are shown as one item per line.  However, when I export to word, the carriage returns (I believe) between each report are lost and the list of reports on separate rows becomes one long string of text.  Below is the dxl code.  Does anyone have an easy solution?  Any help would be greatly appreciated.

Thanks in advance.

 

// DXL generated by DOORS traceability wizard on 25 May 2016.
// Wizard version 2.0, DOORS version 9.6.1.4
pragma runLim, 0
string limitModules[1] = {"3dc85637434f66e3-00002a84"}
int lines[1] = {0}
void adjustLines(int depth, showAtDepth) {
    int count
    for (count = 0; count < 1; count++) {
        while (lines[depth-1] < lines[count]) {
            if (depth == showAtDepth) displayRich("\\pard " " ")
            lines[depth-1]++
        }
    }
}
void showOut(Object o, int depth) {
    Link l
    LinkRef lr
    ModName_ otherMod = null
    Module linkMod = null
    ModuleVersion otherVersion = null
    Object othero
    string disp = null
    string s = null
    string plain, plainDisp
    int plainTextLen
    int count
    bool doneOne = false
    string linkModName = "*"
    for l in all(o->linkModName) do {
        otherVersion = targetVersion l
        otherMod = module(otherVersion)
        if (null otherMod || isDeleted otherMod) continue
        if (!equal(getItem otherMod, (itemFromID limitModules[depth-1]))) continue
        othero = target l
        if (null othero) {
            load(otherVersion,false)
        }
        othero = target l
        if (null othero) continue
        if (isDeleted othero) continue
        int oldLines = lines[depth-1]
        adjustLines(depth, 1)
        bool kick = (doneOne) && (lines[depth-1] == oldLines)
        if (kick) {
            lines[depth-1]++
            if (depth == 1) displayRich("\\pard " " ")
        }
        if (depth < 1) {
            showOut(othero, depth+1)
        }
        doneOne = true
        if (depth == 1) {
            s = probeRichAttr_(othero,"Document Number", false)
            if (s == "")
            displayRich("\\pard " " ")
            else
            displayRich("\\pard " s )""
        }
        lines[depth-1] += 1
    }
    if (depth == 1) {
        ExternalLink extLink
        doneOne = false
        for extLink in o->"" do {
            if (!doneOne) {
                displayRich("\\pard " "{\\b External Links:}")
                doneOne = true
            }
            if (canRead(extLink."Document Number")) s = extLink."Document Number"
            else s = ""
            if (s == "")
            displayRich("\\pard " " ")
            else
            displayRich("\\pard " s)
        }
    }
}
showOut(obj,1)
 

 


billiam45 - Wed May 25 09:07:05 EDT 2016

Re: Export to Word Issue
O.Wilkop - Wed May 25 09:46:51 EDT 2016

Everytime the script calls "displayRich" it adds an automatic newline to the LDXL. I assume it uses "\r" instead of "\n" and later on the word export has issues displaying the newline. You can change your script to add "\n" instead and see if that works:

 

At the beginning, after "pragma runLim, 0" and before the line after add:

 

Buffer b = create();
b = "";
void displayRichOrg(string org){
    displayRich(org);
}

void displayRich(string toDisplay){
    b += toDisplay"\n";
}

 

and at the very end after the "showOut(obj,1)" add:

 

displayRichOrg(stringOf(b));
delete(b);

 

 

This way we tell the script to call our modified version of "displayRich", add a "\n" instead of a "\r" and then display it at the end using the original function.

 

See if that works for you

Re: Export to Word Issue
billiam45 - Wed May 25 10:46:18 EDT 2016

O.Wilkop - Wed May 25 09:46:51 EDT 2016

Everytime the script calls "displayRich" it adds an automatic newline to the LDXL. I assume it uses "\r" instead of "\n" and later on the word export has issues displaying the newline. You can change your script to add "\n" instead and see if that works:

 

At the beginning, after "pragma runLim, 0" and before the line after add:

 

Buffer b = create();
b = "";
void displayRichOrg(string org){
    displayRich(org);
}

void displayRich(string toDisplay){
    b += toDisplay"\n";
}

 

and at the very end after the "showOut(obj,1)" add:

 

displayRichOrg(stringOf(b));
delete(b);

 

 

This way we tell the script to call our modified version of "displayRich", add a "\n" instead of a "\r" and then display it at the end using the original function.

 

See if that works for you

Really close.  I replaced the \n with \\par and it works!! Thank you